const gulp = require("gulp");
const sass = require("gulp-sass");
const postcss = require("gulp-postcss");
sass.compiler = require("node-sass");

gulp.task("sass", function () {
  return gulp
    .src("./sass/index.scss")
    .pipe(sass.sync().on("error", sass.logError))
    .pipe(postcss([require("tailwindcss"), require("autoprefixer")]))
    .pipe(gulp.dest("./public/sass"));
});

gulp.task("watch", function () {
  gulp.watch(["./sass/**/*.scss"], () => {
    return gulp
      .src("./sass/index.scss")
      .pipe(sass.sync().on("error", sass.logError))
      .pipe(postcss([require("tailwindcss"), require("autoprefixer")]))
      .pipe(gulp.dest("./public/sass"));
  });
});
